home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DDJ0192.ARJ / WISC.ASC < prev   
Text File  |  1991-11-21  |  3KB  |  62 lines

  1. _WRITABLE INSTRUCTION SET COMPUTERS_
  2. by Jack J. Woehr
  3.  
  4. [LISTING ONE]
  5.  
  6. \ DEREF a' la Warren Abstract Machine               
  7.  
  8. DECIMAL
  9. 166 OPCODE: WAM-DEREF  ( addr1 -- addr2)
  10.  
  11. 0 :: SOURCE=ALU ALU=B DEST=PC ;; \ RAM pointer := TOS
  12. 1 :: INC[PC] ;;                  \ RAM pointer++
  13. 2 :: SOURCE=RAM ALU=AxnorB ;;    \ @RAM pointer == TOS ??
  14. 3 :: SOURCE=RAM ALU=AxnorB ;;    \ test takes 2 cycles
  15. 4 :: SOURCE=RAM ALU=A DEST=DLO INC[MPC] JMP=11E ;;
  16. \ Jump to 6 if not equal, 7 if equal. Note that the microprogram counter is 
  17. \ incremented in this instruction. The next microinstruction will branch to 
  18. \the next page. Note also that this microinstruction saved the address pointer 
  19. \in DLO for later use.
  20.  
  21. 6 :: SOURCE=ALU ALU=B DEST=PC JMP=000 ;;
  22. \ Re-load RAM pointer with original address, we are continuing
  23. \ via 0 on the next page, since we have run out of space here.
  24.  
  25. 7 :: SOURCE=PCSAVE ALU=A+1 DEST=PC JMP=110 ;;
  26. \ Reload Program Counter, we are leaving via 6 on the next page.
  27.  
  28. 167 CURRENT-PAGE !
  29.  
  30. 0 :: SOURCE=RAM ALU=A DEST=DHI ;; \ DHI := tag
  31. 1 :: SOURCE=DLO ALU=A DEST=PC  ;; \ RAM pointer := next addr
  32. 2 :: SOURCE=RAM ALU=AxnorB ;;     \ Compare tags
  33. 3 :: SOURCE=RAM ALU=AxnorB ;;     \ Comparison takes two cycles
  34. 4 :: SOURCE=DLO ALU=A DEST=DHI JMP=11E ;; ( Jump = 6+boolean)
  35. \ Jump to 6 is tags were equal, to 7 if different. This microinstruction loads 
  36. \ DHI (top of stack) with the current address under examination. Therefore, if
  37. \ this instruction is re-entered, it will have same entry conditions as 
  38. \ previously, but starting at the next reference in the chain.
  39.  
  40. \ This is the exit pointed to by both microinstruction 7 on previous microcode 
  41. \ page, and by the conditional branch in instruction 4 on this page.
  42. 6 :: SOURCE=PCSAVE ALU=A+1 DEST=PC INC[MPC] JMP=101 ;;
  43.  
  44. \ Our exit is long and tortuous! We are exiting via 0 on the next page.
  45. 5 :: JMP=000 ;;
  46. \ This microinstruction is the exit for both 6 and 7.
  47.  
  48. \ This is where "different tags" takes us ... we "fool" the CPU/16
  49. \ into re-executing with original PC value.
  50. 7 :: SOURCE=PCSAVE ALU=A DEST=PC INC[MPC] JMP=101 ;;
  51. \ We are looping by reloading Program Counter with the same address
  52. \ as it contained at entry. But again we are out of room on this
  53. \ microcode page, so we must finish on the next microcode page.
  54.  
  55. 168 CURRENT-PAGE ! \ Increment microcode page under compilation.
  56.  
  57. 0 :: DECODE ;; \ Latch new program counter value.
  58. 1 :: END ;;    \ Exit to next instruction.
  59.  
  60. ;;END
  61.  
  62.